//
//  DKLoginHelpView.m
//  DanKU
//
//  Created by 吴斌 on 2023/9/19.
//

#import "DKLoginHelpView.h"

@implementation DKLoginHelpView
-(instancetype)init{
    if(self == [super init]){
        self.backgroundColor = UIColor.clearColor;
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    UILabel *dk_LoginHelpLab = [[UILabel alloc] init];
    dk_LoginHelpLab.textColor = DK_Hex(@"#999999");
    dk_LoginHelpLab.font = DK_FONT_Regular(12);
    dk_LoginHelpLab.text = @"Why can't I receive the verification code?";
    [self addSubview:dk_LoginHelpLab];
    [dk_LoginHelpLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(59)));
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.bottom.equalTo(@(-DK_IsWidthScale(0)));
    }];
    UIImageView * dk_LoginHelpImgView = [[UIImageView alloc] init];
    dk_LoginHelpImgView.userInteractionEnabled = YES;
    dk_LoginHelpImgView.image = DK_GetImage(@"dk_registerHelp");
    [self addSubview:dk_LoginHelpImgView];
    [dk_LoginHelpImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(dk_LoginHelpLab.mas_right).offset(DK_IsWidthScale(10));
        make.height.equalTo(@(DK_IsWidthScale(16)));
        make.width.equalTo(@(DK_IsWidthScale(16)));
        make.centerY.equalTo(dk_LoginHelpLab);
    }];
    
    UIButton * dk_LoginHelpBtn = [[UIButton alloc] init];
    [dk_LoginHelpBtn addTarget:self action:@selector(goLoginHelp) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:dk_LoginHelpBtn];
    [dk_LoginHelpBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(dk_LoginHelpLab);
        make.right.equalTo(dk_LoginHelpImgView);
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.bottom.equalTo(@(DK_IsWidthScale(0)));
    }];
}
- (void)goLoginHelp{
    if(self.goRegisterHelpBlock){
        self.goRegisterHelpBlock();
    }
}
@end
